<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset='utf-8'>
</head>
   <style type="text/css">
        #box{
            width: 400px;
            height: 400px;
            border: 1px solid #000;
            background-color: #09f;
            position: absolute;
            left: 100px;
            top: 100px;
        }
    </style>
<body>
       
    <div id="box"></div>
        
</body>
    <script>
        var box=document.getElementById('box');

        box.onmousedown = function(){
            box.style.backgroundColor = "#f90";
        }

        box.onmouseup = function(){
            box.style.backgroundColor = "";
        }

        box.onmousemove = function(en){
            // document.title = en.x + ','+en.y;
            document.title = en.offsetX+','+en.offsetY;
        }
    </script>

  
</html>